<%@page import="org.asportoonline.entities.Locale" %>
<%@page import="org.asportoonline.entities.Cliente" %>
<%
    String usertype = "viewer";

    Locale l = (Locale) request.getAttribute("locale");
    Cliente c = null;

    if (session.getAttribute("userid") != null && request.getAttribute("cliente") != null) {
        c = (Cliente) request.getAttribute("cliente");

        if (l.getProprietario().getIdCliente() == c.getIdCliente()) {
            usertype = "proprietario";
        }
    }

    long idlocale = l.getIdLocale();
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tlds/asportoonline.tld" prefix="asportoonline" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>AsportoOnline | Dettagli locale</title>
        <style type="text/css">
            @import url("style.css");
        </style>
    </head>
    <body>
        <div class="meister">
            <div class="page">
                <div class="container">
                    <%@ include file="/WEB-INF/common/header.jsp"%>
                    <div class="navigation"> <a href="MainController?q=index">Home</a> </div>  

                    <h1>Dettagli locale</h1>

                    <asportoonline:dettagli_locale locale="${locale}"></asportoonline:dettagli_locale>

                    <% if (usertype.equals("proprietario")) {%>
                    <a href="MainController?q=fetch_restaurant_details_action&AMP;ret=modify_restaurant&AMP;idlocale=<%=idlocale%>">Modifica dati!</a>
                    <% }%>

                    <h2>Dettagli prodotti</h2>        

                    <asportoonline:elenco_prodotti_locale prodotti="${prodotti}" cliente="<%=c%>"></asportoonline:elenco_prodotti_locale>

                    <% if (usertype.equals("proprietario")) {%>
                    <a href="MainController?q=register_product&AMP;idlocale=<%=idlocale%>">Inserisci prodotto!</a>
                    
                    <br /><br /><br />
                    
                    <a href="MainController?q=fetch_restaurant_prenotations_action&AMP;idlocale=<%=idlocale%>">Vedi prenotazioni!</a>
                    <% }%>
                    
                    
                    
                    <%@ include file="/WEB-INF/common/footer.jsp"%>
                </div>
            </div>
        </div>
    </body>
</html>
